Authentication Method
New Feature
Eggplant DAI API uses open standards authorization (OAuth 2.0 - Client Credentials Grant) to protect its APIs.
You must have a valid access token to use the Eggplant DAI Execution API. To obtain an access token, you need to:
- Retrieve the OAuth credentials for your integration
- Send an authentication request with your OAuth credentials to the token endpoint, shown below, that is generated for you.
Because the token expires after five minutes, to maintain access, you must regularly resend your credentials to get a new access token.
For step-by-step instructions on how to do this, see Getting Started.
Authentication Method
POST -> http://localhost:8000/auth/realms/{realm}/protocol/openid-connect/token
Headers
Name | Value |
---|---|
Content-Type | application/x-www-form-urlencoded |
Body Parameters
Name | Type | Description | Required |
---|---|---|---|
grant_type | string | Type: client_credentials Uses your OAuth credentials to generate an access token. | Yes |
client_id | string | Your client_id | Yes |
client_secret | string | Your client_secret | Yes |
Possible Responses
Status | Status Text | Description |
---|---|---|
200 | OK | Successful response. |
400 | Bad request | Required parameters were not sent |
401 | Bad request | Invalid credentials were provided. |
403 | Forbidden | Not enough available concurrent user licenses |
Response Body JSON
The first example below shows a typical successful response (Status 200).
Example:
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia...",
"expires_in": 300,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 0,
"scope": "email template:dai:agents profile"
}
Name | Type | Description | Value |
---|---|---|---|
access_token | string | Access token for a user account that has successfully authenticated. | <dynamic> |
expires_in | integer | Number of seconds that the access token is valid for. | 300 (or 5 minutes) |
refresh_expires_in | integer | Number of seconds that the refresh token is valid for. | 1800 (or 30 minutes) |
token_type | string | Type of access token used with OAuth 2.0. | bearer |
not-before-policy | boolean | Policy is disabled. | 0 |
scope | string | Grants the permissions of the System Administrator to the resource or application that uses the access token | email template:dai:agents profile |
The next example shows Invalid Response Status 401 Unauthorized.
Example:
{
"message": "Not Authorized",
"description": "The credentials you provided are not valid."
}